<?php
final class Utl
{

    static public function page($url, $page, $count, $offset=20, $status='')
    {
	    $allpage = ceil($count/$offset);

	    if($status)
	    {
	        $status ='&'.$status;
	    }

	    $first = "<a href='".$url.'/page/1'.$status."' id='page_index'>首页</a>";
	    $last  = "<a href='".$url.'/page/'.$allpage.$status."' id='page_end'>末页</a>";

	    if($page > 1)
	    {
	        $prev = "&nbsp;<a href='".$url.'/page/'.($page-1).$status."' id='page_prev'>上一页</a>&nbsp;";
	    }
	    else
	    {
	        $prev = '&nbsp;&nbsp;';
	    }

	    if($page < $allpage)
	    {
	        $next = "&nbsp;<a href='".$url.'/page/'.($page+1).$status."' id='page_next'>下一页</a>&nbsp;";
	    }
	    else
	    {
	        $next = '&nbsp;&nbsp;';
	    }

	    $page = "当前 第<span id='current_id' style='color:gray'> {$page} </span>&nbsp;页";
	    $all  = '总'.$count."条&nbsp;&nbsp;共 ".$allpage." 页&nbsp;&nbsp;&nbsp;&nbsp";
	    $html = $all.$first.$prev.$page.$next.$last;

	    return $html;

	}



	

}
